package GUI;

import DBHandling.CategoryHandling;
import Entity.Category;
import java.io.IOException;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.RowFilter;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;

public class CategoryManagementPanel extends javax.swing.JPanel {

    private Vector<Category> cate;
    private DefaultTableModel model;
    private CategoryHandling catHandle;
    private Category c;
    private TableRowSorter<TableModel> sorter;

    public CategoryManagementPanel() throws Exception {
        initComponents();
        cate = new Vector<Category>();
        setOptionTabel();

        loadData();
    }

    private void setOptionTabel() {
        model = new DefaultTableModel();
        tblCategory.setModel(model);
        model.addColumn("CategoryID");
        model.addColumn("CategoryName");
        sorter = new TableRowSorter<TableModel>(model);
        tblCategory.setRowSorter(sorter);

        //set option text Search
        txtSearch.getDocument().addDocumentListener(new DocumentListener() {

            @Override
            public void changedUpdate(DocumentEvent e) {
                newFilter(txtSearch.getText(), 1);
            }

            @Override
            public void insertUpdate(DocumentEvent e) {
                newFilter(txtSearch.getText(), 1);
            }

            @Override
            public void removeUpdate(DocumentEvent e) {
                newFilter(txtSearch.getText(), 1);
            }
        });
    }
    //load data from database to table 

    public void loadData() throws Exception {
        for (int i = model.getRowCount() - 1; i >= 0; i--) {
            model.removeRow(i);
        }

        catHandle = new CategoryHandling();
        cate = catHandle.getCategories();

        for (Category c : cate) {
            Vector temp = new Vector();
            temp.add(c.getCateID());
            temp.add(c.getCateName());
            model.addRow(temp);
        }
        lblTotal.setText("Total categories: " + cate.size());
    }

    public void setData(Category cate) {
        txtCateID.setText(cate.getCateID());
        txtCateName.setText(cate.getCateName());
    }

    public Category getInputCate() {
        String id = txtCateID.getText();
        String name = txtCateName.getText();
        return new Category(id, name);
    }

    public boolean isValidationForm() {
        String id = txtCateID.getText();
        String name = txtCateName.getText();

        if (id.isEmpty()) {
            txtCateID.requestFocus();
            txtCateID.selectAll();
            JOptionPane.showMessageDialog(this, "The category id is not empty!", "Notice", JOptionPane.OK_OPTION);
            return false;
        } else if (id.length() > 10) {
            txtCateID.requestFocus();
            txtCateID.selectAll();
            JOptionPane.showMessageDialog(this, "The category id's length can not greater than 10 characters!", "Notice", JOptionPane.OK_OPTION);
            return false;
        } else if (name.isEmpty()) {
            txtCateName.requestFocus();
            txtCateName.selectAll();
            JOptionPane.showMessageDialog(this, "The category's name is not empty!", "Notice", JOptionPane.OK_OPTION);
            return false;
        } else if (name.length() > 30) {
            txtCateName.requestFocus();
            txtCateName.selectAll();
            JOptionPane.showMessageDialog(this, "The category name's length can not greater than 30 characters!", "Notice", JOptionPane.OK_OPTION);
            return false;
        }
        return true;
    }

    public boolean isExistedCateID(String itemID) {
        for (Category c : cate) {
            if (c.getCateID().equals(txtCateID.getText())) {
                return true;
            }
        }
        return false;
    }

    private void newFilter(String txt, int mode) {
        RowFilter<TableModel, Object> rf = null;
        // If current expression doesn't parse, don't update.
        try {
            rf = RowFilter.regexFilter(txt, mode);
        } catch (java.util.regex.PatternSyntaxException e) {
            return;
        }
        sorter.setRowFilter(rf);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jToolBar7 = new javax.swing.JToolBar();
        jLabel13 = new javax.swing.JLabel();
        btnHome = new javax.swing.JButton();
        jLabel14 = new javax.swing.JLabel();
        btnAddCate = new javax.swing.JButton();
        jLabel15 = new javax.swing.JLabel();
        btnEditCate = new javax.swing.JButton();
        jLabel16 = new javax.swing.JLabel();
        btnRemoveCate = new javax.swing.JButton();
        jLabel19 = new javax.swing.JLabel();
        btnReset = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        btnHelp = new javax.swing.JButton();
        lblBanner = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        lblCateID = new javax.swing.JLabel();
        lblCateName = new javax.swing.JLabel();
        txtCateID = new javax.swing.JTextField();
        txtCateName = new javax.swing.JTextField();
        jSeparator1 = new javax.swing.JSeparator();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel2 = new javax.swing.JLabel();
        txtSearch = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        tblCategory = new javax.swing.JTable();
        jLabel1 = new javax.swing.JLabel();
        lblStatus = new javax.swing.JLabel();
        lblTotal = new javax.swing.JLabel();

        setBackground(new java.awt.Color(255, 255, 255));
        setMinimumSize(new java.awt.Dimension(700, 300));
        setPreferredSize(new java.awt.Dimension(747, 591));
        setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jToolBar7.setBackground(new java.awt.Color(255, 255, 255));
        jToolBar7.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jToolBar7.setFloatable(false);
        jToolBar7.setRollover(true);
        jToolBar7.setEnabled(false);
        jToolBar7.setName("jToolBar7"); // NOI18N

        jLabel13.setText("                "); // NOI18N
        jLabel13.setToolTipText("");
        jLabel13.setName("jLabel13"); // NOI18N
        jToolBar7.add(jLabel13);

        btnHome.setBackground(new java.awt.Color(255, 255, 255));
        btnHome.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnHome.setForeground(new java.awt.Color(0, 0, 204));
        btnHome.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/home_48.png"))); // NOI18N
        btnHome.setText("    HOME    ");
        btnHome.setFocusable(false);
        btnHome.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnHome.setName("btnHome"); // NOI18N
        btnHome.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnHome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnHomeActionPerformed(evt);
            }
        });
        jToolBar7.add(btnHome);

        jLabel14.setText("                    ");
        jLabel14.setName("jLabel14"); // NOI18N
        jToolBar7.add(jLabel14);

        btnAddCate.setBackground(new java.awt.Color(255, 255, 255));
        btnAddCate.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnAddCate.setForeground(new java.awt.Color(0, 0, 204));
        btnAddCate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/add_item_48.png"))); // NOI18N
        btnAddCate.setText("Add");
        btnAddCate.setFocusable(false);
        btnAddCate.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnAddCate.setName("btnAddCate"); // NOI18N
        btnAddCate.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnAddCate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddCateActionPerformed(evt);
            }
        });
        jToolBar7.add(btnAddCate);

        jLabel15.setText("                    ");
        jLabel15.setName("jLabel15"); // NOI18N
        jToolBar7.add(jLabel15);

        btnEditCate.setBackground(new java.awt.Color(255, 255, 255));
        btnEditCate.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnEditCate.setForeground(new java.awt.Color(0, 0, 204));
        btnEditCate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/edit_item_48.png"))); // NOI18N
        btnEditCate.setText("Edit");
        btnEditCate.setFocusable(false);
        btnEditCate.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnEditCate.setName("btnEditCate"); // NOI18N
        btnEditCate.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnEditCate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEditCateActionPerformed(evt);
            }
        });
        jToolBar7.add(btnEditCate);

        jLabel16.setText("                    ");
        jLabel16.setName("jLabel16"); // NOI18N
        jToolBar7.add(jLabel16);

        btnRemoveCate.setBackground(new java.awt.Color(255, 255, 255));
        btnRemoveCate.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnRemoveCate.setForeground(new java.awt.Color(0, 0, 204));
        btnRemoveCate.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/delete_item_48.png"))); // NOI18N
        btnRemoveCate.setText("Remove");
        btnRemoveCate.setFocusable(false);
        btnRemoveCate.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnRemoveCate.setName("btnRemoveCate"); // NOI18N
        btnRemoveCate.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnRemoveCate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRemoveCateActionPerformed(evt);
            }
        });
        jToolBar7.add(btnRemoveCate);

        jLabel19.setText("                    "); // NOI18N
        jLabel19.setName("jLabel19"); // NOI18N
        jToolBar7.add(jLabel19);

        btnReset.setBackground(new java.awt.Color(255, 255, 255));
        btnReset.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnReset.setForeground(new java.awt.Color(0, 0, 153));
        btnReset.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/left_arrow_48.png"))); // NOI18N
        btnReset.setText("Reset form");
        btnReset.setFocusable(false);
        btnReset.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnReset.setName("btnReset"); // NOI18N
        btnReset.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnReset.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnResetActionPerformed(evt);
            }
        });
        jToolBar7.add(btnReset);

        jLabel7.setText("                ");
        jLabel7.setName("jLabel7"); // NOI18N
        jToolBar7.add(jLabel7);

        jLabel18.setText("  ");
        jLabel18.setName("jLabel18"); // NOI18N
        jToolBar7.add(jLabel18);

        btnHelp.setBackground(new java.awt.Color(255, 255, 255));
        btnHelp.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnHelp.setForeground(new java.awt.Color(0, 0, 204));
        btnHelp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/help icon 48.png"))); // NOI18N
        btnHelp.setText("   Help   ");
        btnHelp.setFocusable(false);
        btnHelp.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnHelp.setName("btnHelp"); // NOI18N
        btnHelp.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnHelp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnHelpActionPerformed(evt);
            }
        });
        jToolBar7.add(btnHelp);

        add(jToolBar7, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 610, 760, -1));

        lblBanner.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/banner2.jpg"))); // NOI18N
        lblBanner.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        lblBanner.setName("lblBanner"); // NOI18N
        add(lblBanner, new org.netbeans.lib.awtextra.AbsoluteConstraints(-10, 0, 1190, 100));

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Category Management", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Lucida Sans", 1, 14), new java.awt.Color(0, 0, 255))); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        lblCateID.setText("Cate ID");
        lblCateID.setName("lblCateID"); // NOI18N
        jPanel1.add(lblCateID, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 40, -1, 17));

        lblCateName.setText("Cate Name");
        lblCateName.setName("lblCateName"); // NOI18N
        jPanel1.add(lblCateName, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 70, -1, 20));

        txtCateID.setName("txtCateID"); // NOI18N
        jPanel1.add(txtCateID, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 40, 190, -1));

        txtCateName.setName("txtCateName"); // NOI18N
        jPanel1.add(txtCateName, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 70, 190, 20));

        jSeparator1.setName("jSeparator1"); // NOI18N
        jPanel1.add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 70, -1, -1));

        jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jSeparator2.setName("jSeparator2"); // NOI18N
        jPanel1.add(jSeparator2, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 20, 10, 90));

        jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(0, 0, 204));
        jLabel2.setText("Search by name");
        jLabel2.setName("jLabel2"); // NOI18N
        jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 30, -1, -1));

        txtSearch.setName("txtSearch"); // NOI18N
        jPanel1.add(txtSearch, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 60, 220, -1));

        add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 160, 700, 140));

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        tblCategory.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Category ID", "Category Name"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tblCategory.setAlignmentX(0.0F);
        tblCategory.setAlignmentY(0.0F);
        tblCategory.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        tblCategory.setName("tableItem"); // NOI18N
        tblCategory.getTableHeader().setReorderingAllowed(false);
        tblCategory.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                tblCategoryMouseReleased(evt);
            }
        });
        jScrollPane1.setViewportView(tblCategory);

        add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 360, 800, 230));

        jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(255, 0, 0));
        jLabel1.setText("Status: ");
        jLabel1.setName("jLabel1"); // NOI18N
        add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 320, -1, -1));

        lblStatus.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
        lblStatus.setForeground(new java.awt.Color(0, 0, 204));
        lblStatus.setText("Load categories complete");
        lblStatus.setName("lblStatus"); // NOI18N
        add(lblStatus, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 320, -1, -1));

        lblTotal.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
        lblTotal.setForeground(new java.awt.Color(0, 0, 204));
        lblTotal.setText("Total categories: 0");
        lblTotal.setName("lblTotal"); // NOI18N
        add(lblTotal, new org.netbeans.lib.awtextra.AbsoluteConstraints(710, 320, -1, -1));
    }// </editor-fold>//GEN-END:initComponents

        private void btnRemoveCateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveCateActionPerformed

            if (JOptionPane.showConfirmDialog(this, "Do you wand to remove category : " + c.getCateName(), "Notice", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
                try {
                    if (catHandle.removeCate(c.getCateID())) {
                        loadData();
                        lblStatus.setText("Remove category sucessful!");
                        resetForm();
                    }
                } catch (Exception ex) {
                    if (ex.getMessage().startsWith("The DELETE statement conflicted")) {
                        JOptionPane.showMessageDialog(this, "Error: Can not remove this category. Because it's using in Items.  you can remove it after it has been deleted in Items ", "Warning", JOptionPane.OK_OPTION);
                    } else {
                        JOptionPane.showMessageDialog(this, "Error: " + ex.getMessage(), "Notice", JOptionPane.OK_OPTION);
                    }
                }
            }
    }//GEN-LAST:event_btnRemoveCateActionPerformed

    //add category
    private void btnAddCateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddCateActionPerformed
        if (!txtCateID.isEditable()) {
            JOptionPane.showMessageDialog(this, "Please click reset form before adding", "Notice", JOptionPane.OK_OPTION);
            return;
        }
        if (isExistedCateID(txtCateID.getText())) {
            txtCateID.requestFocus();
            txtCateID.selectAll();
            JOptionPane.showMessageDialog(this, "The category id already exist!", "Notice", JOptionPane.OK_OPTION);
        } else if (isValidationForm()) {
            try {
                if (catHandle.insertCate(getInputCate())) {
                    resetForm();
                    loadData();
                    lblStatus.setText("Add category sucessful!");

                }
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this, "Error: " + ex.getMessage(), "Notice", JOptionPane.OK_OPTION);
            }
        }

    }//GEN-LAST:event_btnAddCateActionPerformed
    //reset all data in form

    public void resetForm() {
        txtCateID.setText("");
        txtCateName.setText("");
        txtCateID.setEditable(true);

    }
    //back to home
    private void btnHomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHomeActionPerformed

        InventoryManagement.callJPanel(new AdministratorPanel());
    }//GEN-LAST:event_btnHomeActionPerformed

    private void tblCategoryMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblCategoryMouseReleased
        // TODO add your handling code here:
        try {
            txtCateID.setEditable(false);
            int index = sorter.convertRowIndexToModel(tblCategory.getSelectedRow());
            if (index > -1) {
                c = cate.get(index);
                setData(c);
            }
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, "Error: " + ex.getMessage(), "Notice", JOptionPane.OK_OPTION);
        }
    }//GEN-LAST:event_tblCategoryMouseReleased

    private void btnResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnResetActionPerformed
        // TODO add your handling code here:
        resetForm();
    }//GEN-LAST:event_btnResetActionPerformed
    //editCate
    private void btnEditCateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditCateActionPerformed
        // TODO add your handling code here:
        String id = txtCateID.getText();
        try {
            if (tblCategory.getSelectedRow() > -1) {
                if (!id.equals(c.getCateID()) && isExistedCateID(id)) {  //
                    txtCateID.requestFocus();
                    txtCateID.selectAll();
                    JOptionPane.showMessageDialog(this, "The cate id already exist!", "Notice", JOptionPane.OK_OPTION);
                } else if (isValidationForm()) {
                    if (catHandle.updateCate(getInputCate(), c.getCateID())) {
                        loadData();
                        lblStatus.setText("Update item sucessful!");
                        resetForm();
                    }
                }
            } else {
                throw new Exception("Please selected row that you want to edit!");
            }
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, "Error: " + ex.getMessage(), "Notice", JOptionPane.OK_OPTION);
        }
    }//GEN-LAST:event_btnEditCateActionPerformed

    private void btnHelpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHelpActionPerformed
        // TODO add your handling code here:

        try {
            // TODO add your handling code here:
            InventoryManagement.OpenManual();
        } catch (IOException ex) {
            JOptionPane.showMessageDialog(null, "cannot locate manual file in 'manual/ISM_Manual.htm'");
        }
    }//GEN-LAST:event_btnHelpActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAddCate;
    private javax.swing.JButton btnEditCate;
    private javax.swing.JButton btnHelp;
    private javax.swing.JButton btnHome;
    private javax.swing.JButton btnRemoveCate;
    private javax.swing.JButton btnReset;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JToolBar jToolBar7;
    private javax.swing.JLabel lblBanner;
    private javax.swing.JLabel lblCateID;
    private javax.swing.JLabel lblCateName;
    private javax.swing.JLabel lblStatus;
    private javax.swing.JLabel lblTotal;
    private javax.swing.JTable tblCategory;
    private javax.swing.JTextField txtCateID;
    private javax.swing.JTextField txtCateName;
    private javax.swing.JTextField txtSearch;
    // End of variables declaration//GEN-END:variables
}
